/**
 * @date: 2025/3/24
 * @author: 小红
 * @Description: 设置路由
 */

import type { _RouteRecordRaw } from '@/router/types';
import { RouterView } from 'vue-router';

export const settingsRoutes: _RouteRecordRaw[] = [
	{
		name: 'user',
		path: '/settings/user',
		component: {
			render: () =>
				h(
					'div', // 父容器
					{ class: 'settings h-full' },
					[h(RouterView)],
				),
		},
		meta: {
			title: '用户',
			left: [],
			center: [],
			right: [],
		},
		children: [
			{
				name: 'personal',
				path: '/settings/user/personal',
				component: () => import('@/views/system/settings/user/PersonalSettings.vue'),
				meta: {
					title: '个人设置',
					icon: 'EachApp_shenfenzheng',
					left: [],
					center: [],
					right: [],
				},
			},
			{
				name: 'password',
				path: '/settings/user/password',
				component: () => import('@/views/system/settings/user/PasswordSettings.vue'),
				meta: {
					title: '密码设置',
					icon: 'EachApp_geren',
					left: [],
					center: [],
					right: [],
				},
			},
		],
	},
	{
		name: 'manage',
		path: 'manage',
		component: RouterView,
		meta: {
			title: '管理',
			left: [],
			center: [],
			right: [],
		},
		children: [
			{
				name: 'enterprise',
				path: '/settings/manage/enterprise',
				component: RouterView,
				meta: {
					title: '企业管理',
					icon: 'EachApp_shenfenzheng',
					left: [],
					center: [],
					right: [],
				},
			},
			{
				name: 'team',
				path: '/settings/manage/team',
				component: RouterView,
				meta: {
					title: '团队管理',
					icon: 'EachApp_geren',
					left: [],
					center: [],
					right: [],
				},
			},
		],
	},
	{
		name: 'other',
		path: 'other',
		component: RouterView,
		meta: {
			title: '其他',
			left: [],
			center: [],
			right: [],
		},
		children: [
			{
				name: 'clear',
				path: '/settings/other/clear',
				component: RouterView,
				meta: {
					title: '清除缓存',
					icon: 'EachApp_shenfenzheng',
					left: [],
					center: [],
					right: [],
				},
			},
			{
				name: 'logout',
				path: '/settings/other/logOut',
				component: RouterView,
				meta: {
					title: '退出登录',
					icon: 'EachApp_geren',
					left: [],
					center: [],
					right: [],
				},
			},
		],
	},
];

export default [
	{
		path: '/settings',
		name: 'settings',
		component: RouterView,
		children: settingsRoutes,
		meta: {
			title: '系统设置',
		},
		redirect: '/settings/user/personal',
	},
];
